<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        let x=123;
        let x1="dswd";
        let x2=[];
        let obj={};
        function func(){}
        let arrys=[123,"dsd",[],{},func];
        for (const i of arrys) {
             document.write(typeof i);//number string object object  function
             document.write("\n");
        }
        
        // let tw;
        // if(tw==undefined){
        //     throw new Error("没有定义或赋值");
        // }


        //instanceof,判断是否属于这个类型的
        let tw1=[];
        let tw2={};
        console.log(tw1 instanceof Array);//判断tw1是否是数组类型的
        console.log(tw2 instanceof Object);

        console.log("----------------------------");

        //自己定义一个类
        function func(){
            let age;
            let name;
        }
        let  l =new func();//new一个方法
        l.age=250;l.name="唐玮";
        console.log(l instanceof func);//true
        console.log(l instanceof Object);//true所以类的父元素都是Object
     
        //打印l对象的age name
        console.log(l.age,l.name);//250

    </script>
</body>
</html>